package cn.wolfcode.wolf2w.strategy.listener;

import cn.wolfcode.wolf2w.common.redis.service.RedisService;
import cn.wolfcode.wolf2w.common.redis.util.RedisKeys;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.stereotype.Component;

@Component
public class ApplicationCloseListener implements ApplicationListener<ContextClosedEvent> {

    @Autowired
    private RedisService redisService;

    @Override
    public void onApplicationEvent(ContextClosedEvent event) {
        String key = RedisKeys.STRATEGY_STATIS_INIT.join("init");
        redisService.deleteObject(key);
    }
}
